
var moment = require('moment');

var url="http://money.eastmoney.com/news/clcdd.html";  //理财频道(通过)
url="http://world.people.com.cn/GB/1029/42354/index.html";  //亚洲  （通过）
url="http://ent.people.com.cn/GB/81372/index.html";  //全球影讯 ( 通过)
url="http://sports.people.com.cn/GB/202237/index.html"; //体坛资讯
url="http://firm.workercn.cn/497/497.shtml";  //企业频道
url="http://world.people.com.cn/GB/57506/190965/190968/index.html"; //中国声音
url="http://www.news.cn/world/wmyl.htm";  //外媒报道
var type="国际";
var typeName="guoji";
var fileName="licaipindao";
fileName="titanzixun";
fileName="yazhou";
fileName="quanqiuyingxun";
fileName="qiyepindao";
fileName="chinashengyin";
fileName="waimeibaodao";

var typeID=1;
exports.getParam=function()
{
    return {
        paraUrl:url,
        paraType:typeID,
        paraFileName:fileName
    }
}
var robot="全球产业 ---理财频道";
robot="国际体坛---体坛资讯";
robot=" 国家快报---亚洲";
robot="全球娱乐---全球影讯";
robot="全球产业---企业频道";
robot="外媒看中国---中国声音";
robot="媒体专区---外媒报道";
var startTime="2016-9-6 15:16:10";  //http://news.163.com/domestic/
var endTime="2016-9-6 18:30:00";

var pth="./"+typeName+"/"+fileName;
var link=require(pth);

checkTime();
function checkTime(){
    var date=new Date();
    if(date.getFullYear()==parseInt(startTime.split("-")[0])&&(date.getMonth()+1)==parseInt(startTime.split("-")[1])&&date.getDate()==parseInt(startTime.split("-")[2])&&date.getHours()==parseInt(startTime.split(" ")[1].split(":")[0])&&date.getMinutes()==parseInt(startTime.split(" ")[1].split(":")[1])&&date.getSeconds()==parseInt(startTime.split(" ")[1].split(":")[2]))
    {
        if(!link.getStatus()){
            link.setStatus(true);
            console.log("开始抓取"+fileName+type+"新闻");
            link.qqList();
        }
    }
    else if(date.getFullYear()==parseInt(endTime.split("-")[0])&&(date.getMonth()+1)==parseInt(endTime.split("-")[1])&&date.getDate()==parseInt(endTime.split("-")[2])&&date.getHours()==parseInt(endTime.split(" ")[1].split(":")[0])&&date.getMinutes()==parseInt(endTime.split(" ")[1].split(":")[1])&&date.getSeconds()==parseInt(endTime.split(" ")[1].split(":")[2])){
        //停止抓取腾讯新闻
        console.log("停止抓取"+fileName+type+"新闻");
        link.setStatus(false);
    }
    console.log("现在是："+moment().format("YYYY-MM-DD H:mm:ss"))

    setTimeout(function(){
        checkTime();
    },1000);
}
